package com.yunzheng.util;

import com.yunzheng.constants.SystemConstants;
import org.apache.shiro.crypto.hash.Md5Hash;

import java.util.Random;

/**
 * <p>
 * md5加密，用于生成密码
 * </p>
 *
 * @author 杜奕明
 * @date 2019/10/1
 */
public class Md5Util {

    public static String getSalt(Integer n){

        char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890!@#$%^&*()".toCharArray();

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            char aChar = chars[new Random().nextInt(chars.length)];
            sb.append(aChar);
        }
        return sb.toString();
    }

}
